﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MyLesson.ascx.cs" Inherits="TeachingAffairsManagementSystem.UserControl.RightContent.Student.MyLesson" %>
<%@ Register Src="~/WebControl/AlertBox.ascx" TagPrefix="uc1" TagName="AlertBox" %>


<uc1:alertbox runat="server" id="Alert"/>
<asp:GridView ID="GVMyLesson" runat="server" DataSourceID="MyLessonDataSource" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="student_s_id,lesson_l_id,lesson_teacher_t_id" OnRowCommand="GVMyLesson_RowCommand" ShowHeaderWhenEmpty="True" CssClass="table table-bordered table-hover">
    <Columns>
        <asp:BoundField DataField="student_s_id" HeaderText="student_s_id" ReadOnly="True" SortExpression="student_s_id" Visible="False"/>
        <asp:BoundField DataField="lesson_teacher_t_id" HeaderText="lesson_teacher_t_id" ReadOnly="True" SortExpression="lesson_teacher_t_id" Visible="False"/>
        <asp:BoundField DataField="lesson_l_id" HeaderText="课程ID" ReadOnly="True" SortExpression="lesson_l_id"/>
        <asp:BoundField DataField="l_name" HeaderText="课程名称" SortExpression="l_name"/>
        <asp:BoundField DataField="t_name" HeaderText="教师名称" SortExpression="t_name"/>
        <asp:BoundField DataField="score" HeaderText="分数" SortExpression="score"/>
        <asp:BoundField DataField="create_time" HeaderText="加入时间" SortExpression="create_time"/>
        <asp:BoundField DataField="finished" HeaderText="已结束" SortExpression="finished"/>
        <asp:TemplateField ShowHeader="False">
            <ItemTemplate>
                <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="false" CommandName="DropLesson" Text="退出课程" CommandArgument='<%#Container.DataItemIndex %>' OnClientClick="return confirm('确定要退出吗？')"></asp:LinkButton>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
    <EmptyDataTemplate>
        无结果
    </EmptyDataTemplate>
</asp:GridView>
<asp:SqlDataSource ID="MyLessonDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:sitedbConnectionString %>" ProviderName="<%$ ConnectionStrings:sitedbConnectionString.ProviderName %>" SelectCommand="SELECT * FROM view_student_has_lesson WHERE (student_s_id = ?)">
    <SelectParameters>
        <asp:SessionParameter Name="student_s_id" SessionField="id" Type="Int32"/>
    </SelectParameters>
</asp:SqlDataSource>